package com.exmaple.result;

/**
 * 异常基础类
 * 以后异常先分模块再分层extends BaseException
 */
public class BaseException extends RuntimeException {
    private ErrorCode errorCode;

    // xcrj 需要被继承的类的构造器不能被私有化，否则造成继承类无法调用super()
    public BaseException() {}

    public BaseException(ErrorCode errorCode) {
        super(errorCode.getDescription());
        this.errorCode=errorCode;
    }
    
    public BaseException(ErrorCode errorCode, Throwable cause) {
        super(errorCode.getDescription(),cause);
        this.errorCode=errorCode;
    }

    public ErrorCode getErrorCode(){return this.errorCode;}
}
